#include <QtGui/QApplication>
#include "MyProject.h"

#include <map>
#include <cv.h>
#include <highgui.h>

#include "ITouchScreen.h"
#include "TouchScreenDevice.h"
#include "TouchData.h"

using namespace touchlib;

using namespace std;

#include <iostream>
#include <stdlib.h>
#include <string>



int main(int argc, char* argv[])
{
	QApplication a(argc, argv);
	MyProject w;

	string bgLabel;
	bool OK;

	//Create ITouchScrenn and load the configuration
	w.screen = TouchScreenDevice::getTouchScreen();	
	//w.screen->setDebugMode(false);

	/*while(!calibrated) {
		w.screen->beginCalibration();
		w.screen->
		calibrated = true;
	}*/
	OK = w.screen->loadConfig("config.xml");
	cout <<"\n\n\n" << OK << "\n\n\n" <<endl;

	if(!OK){
	   cout<< "error loading config file\n"<<endl;
       exit(0);  // error
	}


	w.screen->registerListener((ITouchListener *)&w);
	w.screen->beginProcessing();
    w.screen->beginTracking();	

	w.show();
	a.connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit()));

	
	
	return a.exec();
}
